<!DOCTYPE html>
<html lang="zh">
<head>
	<title>接口列表</title>
		<#include "include_page/header.html"/>
	<script src="http://libs.useso.com/js/jquery/1.9.1/jquery.min.js"></script>
	<script src="${res}/code-formatter.js" type="text/javascript"></script>
	<link href="${res}/code-formatter.css" type="text/css" rel="stylesheet"></link>
<style>
#sendData {
width: 500px; height: 50px;
}

#rawJson {
width:100%; height: 50px;
}
</style>
<script>
function change(){
	$.ajax({
	    url: 'directive.json?'+$('#sendData').val(),
	    type: 'GET',
	    contentType:'application/json; charset=UTF-8',
	    dataType: 'text',
	    success: function (data) {
	    	$('#rawJson').val(data);
	    	process($('#rawJson'),$('.canvas'));
	    }
	});
}
$.ajax({
	url:'directives.json',type: 'GET',
	contentType:'application/json; charset=UTF-8',
	dataType: 'json',
	success: function (dataList) {
		$(dataList).each(function(index,data){
			$('#interfaes').append(' <a href="javascript:;" onclick="$(\'#sendData\').val(\'action='+data+'\');return false;">'+data+'</a> ');
		});
	}
});
</script>
</head>
<body>
<#include "include_page/nav.html"/>
<script>
	$("header nav ul li a:contains('接口测试')").parent().addClass('selected');
</script>
<main>
	<div class="container">
		<fieldset>
			<legend>接口测试</legend>
		  	<p>
		  		地址：directive.json?
		  		<textarea id="sendData">action=contentList&count=3</textarea>
		  	</p>
			<p><input type="button" value="发送请求" onclick="change()"/> <a href="${res}/doc.txt" target="_blank">接口使用参考自定义指令使用规则</a></p>
			<p id="interfaes">接口列表：</p>
		</fieldset>
		<fieldset>
			<legend>返回报文</legend>
			<textarea id="rawJson"></textarea>
			<p><input type="button" value="格式化" onclick="process($('#rawJson'),$('.canvas'))"/></p>
			<div class="canvas"></div>
		</fieldset>
	</div>
</main>
<#include "include_page/footer.html"/>
</body>
</html>